﻿<UserControl x:Class="YATE.ButtonImg"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             Name="UC"
             Width="26"
             Height="26"
             HorizontalAlignment="Center"
             VerticalAlignment="Center"
             Padding="1"
             d:DesignHeight="24"
             d:DesignWidth="24"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Style/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Button Margin="0"
            HorizontalAlignment="Stretch"
            HorizontalContentAlignment="Stretch"
            VerticalContentAlignment="Stretch"
            Click="Button_Click"
            Padding="0"
            Style="{DynamicResource CMButton_WhiteBack}"
            Tag="{Binding ElementName=UC,
                          Path=Tag,
                          Mode=TwoWay}">
        <Grid HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="24" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="24" />
            </Grid.RowDefinitions>
            <Rectangle Grid.Column="0"
                       Width="14"
                       Height="14"
                       Margin="5,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Fill="{Binding ElementName=UC,
                                      Path=Foreground}">
                <Rectangle.OpacityMask>
                    <VisualBrush Stretch="Uniform" Visual="{Binding ElementName=UC, Path=Image}" />
                </Rectangle.OpacityMask>
            </Rectangle>
        </Grid>
    </Button>
</UserControl>
